using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace MyMvc.Model.Models.Mapping
{
    public class FileMap : EntityTypeConfiguration<File>
    {
        public FileMap()
        {
            // Primary Key
            this.HasKey(t => t.ID);

            // Properties
            this.Property(t => t.FileName)
                .IsRequired()
                .HasMaxLength(1024);

            this.Property(t => t.Address)
                .IsRequired();

            // Table & Column Mappings
            this.ToTable("File");
            this.Property(t => t.ID).HasColumnName("ID");
            this.Property(t => t.FileName).HasColumnName("FileName");
            this.Property(t => t.Address).HasColumnName("Address");
        }
    }
}
